package practice1_100;

public class Practice27 {
    //思路：遍历数组，遇到相同的什么都不做，遇到不同的往前挪动，并让index++，最后返回index
    public int removeElement(int[] nums, int val) {
        int index=0;
        for (int i=0;i<nums.length;i++){
            if(val!=nums[i]){
                nums[index]=nums[i];
                index++;
            }
        }
        return index;
    }
    public static void main(String[] args) {
        System.out.println(val());
        for (int i = 0; i++ < 10; ) {
                System.out.println(i);
        }
    }

    public static int val() {
        int num = 5;
        try {
           return num/0 ;
        } catch (Exception e) {
            num = 10;
        } finally {
            num = 15;
        }
        //return num;
        return 100 ;
    }
}
